package com.me.Inheritor;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
// It's possible that I'll need some of these later.
//import com.badlogic.gdx.graphics.OrthographicCamera;
//import com.badlogic.gdx.graphics.Texture;
//import com.badlogic.gdx.graphics.Texture.TextureFilter;
//import com.badlogic.gdx.graphics.g2d.Sprite;
//import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class Project_AndroidApp implements ApplicationListener 
{
	SpriteBatch	batch;
	ObjectManager objMan;
	int background;
	
	@Override
	public void create() 
	{
		batch = new SpriteBatch();
		objMan = new ObjectManager();
		background = GameData.getTextureManager().LoadTexture( "data/background.png" );
		
		Player player = new Player();
		
		GameData.setPlayer( player );
		GameData.setObjectManager( objMan );
	}

	@Override
	public void dispose() 
	{
		batch.dispose();
		objMan.Dispose();
	}

	@Override
	public void render() 
	{
		objMan.Update( Gdx.graphics.getDeltaTime() );
		
		Gdx.gl.glClearColor(1, 1, 1, 1);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
		
		// Rendering has started
		batch.begin();
		
		batch.draw( GameData.getTextureManager().getTexture( background ),0,0 );
		
		// Render all the objects in the object manager
		objMan.Render( batch );
		
		// Rendering is over
		batch.end();
	}

	@Override
	public void resize(int width, int height) 
	{
	}

	@Override
	public void pause() 
	{
	}

	@Override
	public void resume() 
	{
	}
}
